package test1;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import java.util.Scanner;
public class 作业 {
    public static void main(String[] args) {
        Admin a=new Admin("02","gly","1234","男",18,2);
        Tearch t=new Tearch("01","js","4567","女",19,1);
        Student s=new Student("00","xs","6789","男",18,0,90,80,80);

        List list=new ArrayList();
        list.add(a);
        list.add(t);
        list.add(s);
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入账号密码：");
        String un=sc.next();
        String pw=sc.next();
        Iterator i= list.iterator();

        while(i.hasNext()){
            Person p=(Person) i.next();
            if(p.getUsername().equals(un)&&p.getPassword().equals(pw)){
                if(p.getRole()==0){
                    System.out.println("欢迎学生登录");
                    System.out.print("输入相应查询序号查询专业成绩：\n0语文\n1英语\n2数学\n3退出");

                    out: while(true){
                        int xz=sc.nextInt();
                        if(xz==0){
                            s.setZhuanye("语文");
                            System.out.println(s.getChinese());
                            continue out;
                        }else if(xz==1){
                            s.setZhuanye("英语");
                            System.out.println( s.getEnglish());
                            continue out;
                        }else if(xz==2){
                            s.setZhuanye("数学");
                            System.out.println(s.getMath());
                            continue out;
                        }else if(xz==3){
                            return;
                        }
                    }
                }else if(p.getRole()==1){
                    System.out.println("欢迎教师登录:请选择相应课程录入学生的成绩 0语文  1英语 2 数学");
                    out: while(true){
                        int xz=sc.nextInt();
                        if(xz==0){
                            t.setKecheng("语文");
                            xz=sc.nextInt();
                            s.setChinese(xz);
                            continue out;
                        }else if(xz==1){
                            t.setKecheng("英语");
                            xz=sc.nextInt();
                            s.setEnglish(xz);
                            continue out;
                        }else if(xz==2){
                            t.setKecheng("数学");
                            xz=sc.nextInt();
                            s.setMath(xz);
                            continue out;
                        }else if(xz==3){
                            System.out.println("退出");
                            return;
                        }
                    }//今日任务
                }else if(p.getRole()==2){
                    System.out.println("欢迎管理员登录");
                    out: while(true){
                        System.out.println("欢迎管理员登录:选择功能 0添加 1修改 2删除（无改动学生成绩权限）");
                        int xz=sc.nextInt();
                        if(xz==0){

                        }
                    }
                }
            }

        }

    }
}



class Person{
    String number;
    String username;
    String password;
    String sex;
    int age;
    int role;




    public String getNumber() {
        return number;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getSex() {
        return sex;
    }

    public int getAge() {
        return age;
    }

    public int getRole() {
        return role;
    }
}

class Admin extends Person{

    public Admin(String number, String username, String password, String sex, int age, int role) {
        this.number = number;
        this.username = username;
        this.password = password;
        this.sex = sex;
        this.age = age;
        this.role = role;
    }


}
class Tearch extends Person{
    String kecheng;

    public Tearch(String number, String username, String password, String sex, int age, int role) {
        this.number = number;
        this.username = username;
        this.password = password;
        this.sex = sex;
        this.age = age;
        this.role = role;
    }

    public String getKecheng() {
        return kecheng;
    }

    public void setKecheng(String kecheng) {
        this.kecheng = kecheng;
        System.out.println("专业："+this.kecheng+"\t");
    }
}
class Student extends Person{
    String zhuanye;
    int chinese;
    int english;
    int math;

    public Student(String number, String username, String password, String sex, int age, int role,int chinese,int english,int math) {
        this.number = number;
        this.username = username;
        this.password = password;
        this.sex = sex;
        this.age = age;
        this.role = role;
        this.chinese=chinese;
        this.english=english;
        this.math=math;
    }

    public void setZhuanye(String zhuanye) {
        this.zhuanye = zhuanye;
        System.out.print("专业："+zhuanye+"\t");

    }

    public void setChinese(int chinese) {
        this.chinese = chinese;
        System.out.print("语文成绩："+chinese);
    }

    public void setEnglish(int english) {
        this.english = english;
        System.out.print("英语成绩："+english);
    }

    public void setMath(int math) {
        this.math = math;
        System.out.print("数学成绩："+math);
    }

    public String getZhuanye() {
        return zhuanye;
    }

    public int getChinese() {
        System.out.print("语文成绩:");
        return chinese;
    }

    public int getEnglish() {
        System.out.print("英语成绩：");
        return english;
    }

    public int getMath() {
        System.out.print("数学成绩：");
        return math;
    }

}